/*
 * 
 * v1.2 by tonydon
 */
package cn.txdnet.txcms.domain;

import cn.txdnet.txweb.annotation.validation.ClearXss;
import cn.txdnet.txweb.annotation.validation.CurrTime;
import cn.txdnet.txweb.annotation.validation.Default;
import cn.txdnet.txweb.annotation.validation.Match;
import cn.txdnet.txweb.annotation.validation.NotEmpty;
import cn.txdnet.txweb.annotation.validation.Size;
import cn.txdnet.txweb.annotation.validation.Validator;

/**
 *
 * @author tangxiaodong
 */
public class TinyCmt extends BaseEntity {

    private static final long serialVersionUID = -3910722470528430458L;
    
    private Long id;
    
    @NotEmpty
    @Match(Match.RegexType.NICK)
    private String nick;
    
    @CurrTime
    private Long pubtime;
    
    @ClearXss
    @Size(min=1,max=200)
    private String content;
    
    @Default("-")
    private String ip;
    
    @Default
    private Byte pubstate;
    
    @Default
    private Integer tophitnum;
    
    @Default
    private Integer stephitnum;
    
    @NotEmpty
    private Long relateid;
    
    @Default
    private Byte channeltype;

    @Override
    public boolean validate() {
        return Validator.validate(this);
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TinyCmt other = (TinyCmt) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "TinyCmt{" + "id=" + id + ", nick=" + nick + ", pubtime=" + pubtime + ", content=" + content + ", ip=" + ip + ", pubstate=" + pubstate + ", tophitnum=" + tophitnum + ", stephitnum=" + stephitnum + ", relateid=" + relateid + ", channeltype=" + channeltype + '}';
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the nick
     */
    public String getNick() {
        return nick;
    }

    /**
     * @param nick the nick to set
     */
    public void setNick(String nick) {
        this.nick = nick;
    }

    /**
     * @return the pubtime
     */
    public Long getPubtime() {
        return pubtime;
    }

    /**
     * @param pubtime the pubtime to set
     */
    public void setPubtime(Long pubtime) {
        this.pubtime = pubtime;
    }

    /**
     * @return the content
     */
    public String getContent() {
        return content;
    }

    /**
     * @param content the content to set
     */
    public void setContent(String content) {
        this.content = content;
    }

    /**
     * @return the ip
     */
    public String getIp() {
        return ip;
    }

    /**
     * @param ip the ip to set
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * @return the pubstate
     */
    public Byte getPubstate() {
        return pubstate;
    }

    /**
     * @param pubstate the pubstate to set
     */
    public void setPubstate(Byte pubstate) {
        this.pubstate = pubstate;
    }

    /**
     * @return the tophitnum
     */
    public Integer getTophitnum() {
        return tophitnum;
    }

    /**
     * @param tophitnum the tophitnum to set
     */
    public void setTophitnum(Integer tophitnum) {
        this.tophitnum = tophitnum;
    }

    /**
     * @return the stephitnum
     */
    public Integer getStephitnum() {
        return stephitnum;
    }

    /**
     * @param stephitnum the stephitnum to set
     */
    public void setStephitnum(Integer stephitnum) {
        this.stephitnum = stephitnum;
    }

    /**
     * @return the relateid
     */
    public Long getRelateid() {
        return relateid;
    }

    /**
     * @param relateid the relateid to set
     */
    public void setRelateid(Long relateid) {
        this.relateid = relateid;
    }

    /**
     * @return the channeltype
     */
    public Byte getChanneltype() {
        return channeltype;
    }

    /**
     * @param channeltype the channeltype to set
     */
    public void setChanneltype(Byte channeltype) {
        this.channeltype = channeltype;
    }
}
